//index.js
//获取应用实例
var app = getApp()
Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    imgUrls: [
      'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
    ],
    tel:'15888888888'
  },
  //查看地图事件 yjmp
  watchPos:function(){
    wx.openLocation(
      {"latitude":34.619683,"longitude":112.45404}
    )
  },
  //打电话
  telTo:function(event){
    var tel = event.currentTarget.dataset.tel
    wx.makePhoneCall({
      phoneNumber: tel
    })
  },
  //val为页面参数
  onLoad: function (val) {
    console.log('onLoad函数开始执行')
    var that = this
    //调用应用实例的方法获取全局数据
    app.getUserInfo(function(userInfo){
      //更新数据
      that.setData({
        userInfo:userInfo
      })
      var goodsId = wx.getStorageSync('goodsId', goodsId)
      //远程获取该页数据
      //页面加载动画
    })
  },
  onShareAppMessage: function () {
    return {
      title: '分享这个页面',
      path: '/pages/index'
    }
  }
})
